/**
 * Created with IntelliJ IDEA.
 * Description:
 */
public class Demo1 {
    public static void main(String[] args) throws InterruptedException {
        Thread mainThread =Thread.currentThread();
        Thread thread1 = new Thread(()->{
           for(int i=0;i<3;i++){
               try {
                   Thread.sleep(2000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
            try {
                mainThread.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });
        System.out.println(thread1.getState());
        thread1.start();
        System.out.println(thread1.getState());
        Thread.sleep(1000);
        System.out.println(thread1.getState());
        Thread.sleep(10000);
        System.out.println(thread1.getState());
    }
}
